package com.agann.util;

import com.agann.model.Memory;
import com.agann.model.Record;

public class OBV extends Memory {
	
	/**
	 * Type Code
	 */
	public static final String TYPE_CODE = "OBV";
	public static final String OBV_SCORE = "obv_score";

	public OBV(String code) {
		super(code);
	}

	@Override
	public void update(Record record) {
		double t = record.getOpen() - record.getClose();
		if (t > 0) {
			setScore(OBV_SCORE, getScore(OBV_SCORE) + record.getVolumn());
		} else if (t < 0){
			setScore(OBV_SCORE, getScore(OBV_SCORE) - record.getVolumn());
		}
	}

	@Override
	public void merge(String code) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void change(double rate) {
		// TODO Auto-generated method stub
		
	}

}
